import { Modal } from '@kedacom/react-next'
import { useBasicInfoStore } from '../store'
import shallow from 'zustand/shallow'
import Docs, { DocsRef } from './Doc'
import { useRef } from 'react'
import { t } from 'i18next'

export default function MeetingFileModal() {
	const DocsRef = useRef<DocsRef | null>(null)
	const { _isMeetingFileShow, update } = useBasicInfoStore(
		(state) => ({
			_isMeetingFileShow: state._isMeetingFileShow,
			update: state.update,
		}),

		shallow
	)
	return (
		<Modal
			title={t('会议文档')}
			open={_isMeetingFileShow}
			width={848}
			height={508}
			needFooter={false}
			onCancel={() => {
				update({ _isMeetingFileShow: false })
				let number = DocsRef.current?.getFileNumber()
				update({ fileNumber: number ?? 0 })
			}}
		>
			<Docs ref={DocsRef} />
		</Modal>
	)
}
